/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.lucava.boatskeeper.server.handler.boat;

import net.customware.gwt.dispatch.server.ActionHandler;
import net.customware.gwt.dispatch.server.ExecutionContext;
import net.customware.gwt.dispatch.shared.ActionException;
import org.lucava.boatskeeper.server.MockCategoryDao;
import org.lucava.boatskeeper.shared.rpc.boat.GetCategories;
import org.lucava.boatskeeper.shared.rpc.boat.GetCategoriesResult;

/**
 *
 * @author glenn
 */
public class GetCategoriesHandler implements ActionHandler<GetCategories, GetCategoriesResult> {

    @Override
    public Class<GetCategories> getActionType() {
        return GetCategories.class;
    }

    @Override
    public GetCategoriesResult execute(GetCategories a, ExecutionContext ec) throws ActionException {
        
        GetCategoriesResult getCategoriesResult = new GetCategoriesResult(MockCategoryDao.getAll());

        return getCategoriesResult;
    }

    @Override
    public void rollback(GetCategories a, GetCategoriesResult r, ExecutionContext ec) throws ActionException {
    }
}
